MySQL error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') as C2 on C2.TOBJID=C1.OBJID
LEFT JOIN c_author au ON au.ID=C1.AUTHORID
lef' at line 27
SELECT C1.ID, C1.NAME, t.TITLE NAME1, C1.DESCRIPTION, C1.DISTRIBUTION,
C1.TAXON, C1.OBJID,
C1.AUTHORID AUID, au.NAME AUNAME, C1.AYEAR, C1.ABRACK, C1.AYEARREM,
C2.DETDESC DETDESC_FM, C2.ID C2ID, C2.NAME C2NAME, C2.NAME1 C2NAME1,
C1.ORIGSP,
C1.STATE_IDIMAGE, C1.TAXA_TYPE, C1.ORIGGEN, C1.ORIGSUBGEN,
ogn.NAME OGNNAME, osg.NAME OSGNAME,
gn.ID GNID, gn.NAME GNNAME, sgn.ID SGNID, sgn.NAME SGNNAME, C1.RANK,
(get_taxa_icon(C1.ID)) CLASS_ICONID, C1.TAXA_REMARK, C1.REFID, C1.TAXON,
(SELECT COUNT(*)
FROM (
SELECT MIN(ID) ID FROM articles a
WHERE a.CLASSID=2433
AND (a.DATE_TIME <> '' OR a.PLACE <> '')
GROUP BY a.DATE_TIME, a.PLACE
) as DS
)
DISTRCNT
FROM classes C1
LEFT JOIN
(SELECT t.OBJID TOBJID, c2.ID, c2.DETDESC, c2.NAME, c2.NAME1
from classobj_tree t
JOIN classes c2 ON c2.OBJID=t.POBJID AND c2.RANK=13
WHERE t.OBJID=
) as C2 on C2.TOBJID=C1.OBJID
LEFT JOIN c_author au ON au.ID=C1.AUTHORID
left join languages l on l.CODE='en'
left join titles t on t.LANGID=l.ID AND t.SIGNATURE='classes' and t.POBJID=C1.OBJID
left join classes ogn on ogn.ID = C1.ORIGGEN
left join classes osg on osg.ID = C1.ORIGSUBGEN
LEFT JOIN classes gn ON gn.OBJID =
(CASE WHEN C1.RANK=2
THEN (SELECT t.POBJID
FROM classobj_tree t
WHERE t.OBJID=C1.OBJID AND t.PRANK=7 LIMIT 1 )
ELSE NULL
END)
LEFT JOIN classes sgn ON sgn.OBJID =
(CASE WHEN C1.RANK=2
THEN (SELECT t.POBJID
FROM classobj_tree t
WHERE t.OBJID=C1.OBJID AND t.PRANK=6 LIMIT 1 )
ELSE NULL
END)
WHERE C1.ID=2433
1: SELECT C1.ID, C1.NAME, t.TITLE NAME1, C1.DESCRIPTION, C1.DISTRIBUTION,
2: C1.TAXON, C1.OBJID,
3: C1.AUTHORID AUID, au.NAME AUNAME, C1.AYEAR, C1.ABRACK, C1.AYEARREM,
4: C2.DETDESC DETDESC_FM, C2.ID C2ID, C2.NAME C2NAME, C2.NAME1 C2NAME1,
5: C1.ORIGSP,
6: C1.STATE_IDIMAGE, C1.TAXA_TYPE, C1.ORIGGEN, C1.ORIGSUBGEN,
7: ogn.NAME OGNNAME, osg.NAME OSGNAME,
8: gn.ID GNID, gn.NAME GNNAME, sgn.ID SGNID, sgn.NAME SGNNAME, C1.RANK,
9: (get_taxa_icon(C1.ID)) CLASS_ICONID, C1.TAXA_REMARK, C1.REFID, C1.TAXON,
10:
11: (SELECT COUNT(*)
12: FROM (
13: SELECT MIN(ID) ID FROM articles a
14: WHERE a.CLASSID=2433
15: AND (a.DATE_TIME <> '' OR a.PLACE <> '')
16: GROUP BY a.DATE_TIME, a.PLACE
17: ) as DS
18:
19: )
20: DISTRCNT
21: FROM classes C1
22: LEFT JOIN
23: (SELECT t.OBJID TOBJID, c2.ID, c2.DETDESC, c2.NAME, c2.NAME1
24: from classobj_tree t
25: JOIN classes c2 ON c2.OBJID=t.POBJID AND c2.RANK=13
26: WHERE t.OBJID=
27: ) as C2 on C2.TOBJID=C1.OBJID
28:
29: LEFT JOIN c_author au ON au.ID=C1.AUTHORID
30: left join languages l on l.CODE='en'
31: left join titles t on t.LANGID=l.ID AND t.SIGNATURE='classes' and t.POBJID=C1.OBJID
32: left join classes ogn on ogn.ID = C1.ORIGGEN
33: left join classes osg on osg.ID = C1.ORIGSUBGEN
34: LEFT JOIN classes gn ON gn.OBJID =
35: (CASE WHEN C1.RANK=2
36: THEN (SELECT t.POBJID
37: FROM classobj_tree t
38: WHERE t.OBJID=C1.OBJID AND t.PRANK=7 LIMIT 1 )
39: ELSE NULL
40: END)
41: LEFT JOIN classes sgn ON sgn.OBJID =
42: (CASE WHEN C1.RANK=2
43: THEN (SELECT t.POBJID
44: FROM classobj_tree t
45: WHERE t.OBJID=C1.OBJID AND t.PRANK=6 LIMIT 1 )
46: ELSE NULL
47: END)
48: WHERE C1.ID=2433